<template>
  <div class="productList">
      <!-- 导航栏开始 -->
      <van-nav-bar
        title="服务产品"
        left-text="返回"
        left-arrow
        @click-left="backHandler"
      />
      <!-- 导航栏结束 -->
      <!-- 侧边导航开始 -->
      <div class="sidebar">
            <van-sidebar v-model="activeKey">
                <van-sidebar-item v-for="item in categorys" :key="item.id" :title="item.name" />
            </van-sidebar>
      </div>
      <!-- 侧边导航结束 -->
      <div class="content"></div>
  </div>
</template>

<script>
import {get} from '@/http/axios.js'
export default {
    data() {
        return{
            activeKey:0,
            categorys:[],
            list:{
                page: 1,
                pageSize:10
            }
        }
    },
    methods: {
        //查询所有分类信息
      findAllCategory(){
          get('/productCategory/pageQuery',this.list).then(res=>{
            this.categorys = res.data.data.list
          })
      },
      //回到上一级
      backHandler(){
          this.$router.back()
      }
    },
    created(){
        this.findAllCategory()
        this.activeKey = this.$route.query.index
    }
}
</script>

<style scoped>


</style>